SMTP Server Test Using PowerShell
-
Run PowerShell as an administrator:
-
Enter the user credentials. That is the Office 365, GSuite, etc., email address and password.
In PowerShell, type $msolcred = get-credential and press <Enter>. Enter the email address and password here, and click OK:
-
Sending the test email:
In PowerShell, type: Send-MailMessage –From mail@yourcompany.com –To user@yourcompany.com –Subject “Test Email” –Body “Test Text” -SmtpServer smtp.office365.com -Credential $msolcred -UseSsl -Port 587, and press <Enter>.
smtp.office365.com is shown as an example; you may insert another SMTP server address, such as smtp.gmail.com.
- If all worked correctly, a test email should be received.